//
//  EGExcelTableHeader.swift
//  EGExcel
//
//  Created by youzy01 on 2021/4/16.
//

import UIKit

class EGExcelTableHeader: UICollectionReusableView {
    lazy var textLabel: UILabel = {
        let label = UILabel()
        label.textColor = Color.c333333
        label.font = UIFont.systemFont(ofSize: 12)
        label.textAlignment = .center
        return label
    }()

    override init(frame: CGRect) {
        super.init(frame: frame)
        textLabel.translatesAutoresizingMaskIntoConstraints = false
        addSubview(textLabel)
        NSLayoutConstraint.activate([
            textLabel.leftAnchor.constraint(equalTo: leftAnchor, constant: 10),
            textLabel.rightAnchor.constraint(equalTo: rightAnchor, constant: -10),
            textLabel.centerYAnchor.constraint(equalTo: centerYAnchor)
        ])

        backgroundColor = Color.cF8F8F8

        let bottomLineLayer = CALayer()
        bottomLineLayer.backgroundColor = Color.cEEEEEE.cgColor
        bottomLineLayer.frame = CGRect(x: 0, y: frame.height - 1, width: frame.width, height: 1)
        layer.addSublayer(bottomLineLayer)

        let rightLineLayer = CALayer()
        rightLineLayer.backgroundColor = Color.cEEEEEE.cgColor
        rightLineLayer.frame = CGRect(x: frame.width - 1, y: 0, width: 1, height: frame.height)
        layer.addSublayer(rightLineLayer)
    }

    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
